import { request } from "@/utils/http";
import {
  getHospitalSearchParamsType,
  getHospitalListType,
  getProvinceListType,
  getCityType,
  getHospitalDetailType,
} from "./model/hospitalListType";

//获取医院列表的全部数据
export const getHospitalListRequest = (
  page: number,
  limit: number,
  searchParams: getHospitalSearchParamsType
) => {
  return request.get<any, getHospitalListType>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: searchParams,
    }
  );
};

//获取请求省份的数据
export const getProvinceListRequest = () => {
  return request.get<any, getProvinceListType>(
    "/admin/cmn/dict/findByDictCode/province"
  );
};

//获取市或区的数据
export const getCityOrStrictRequest = (id: string) => {
  // console.log(id);
  return request.get<any, getCityType>(`/admin/cmn/dict/findByParentId/${id}`);
};

//请求详情页信息
export const getHospitalDetailRequest = (id: string) => {
  return request.get<any, getHospitalDetailType>(
    `/admin/hosp/hospital/show/${id}`
  );
};

//改变状态
export const changeHospitalStatus = (id: string, status: 0 | 1) => {
  // console.log(id,status);  
  return request.get(`/admin/hosp/hospital/updateStatus/${id}/${status}`);
};
